﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Globalization;
using System.Threading;
using BulldogCMS.Core.Runtime;

namespace BulldogCMS.Core.MVC
{
    public class MVCRequestContextProvider : IRequestContextProvider
    {
        public RequestContext GetRequestContext()
        {
            if (HttpContext.Current.Items.Contains("requestContext"))
            {
                return HttpContext.Current.Items["requestContext"] as RequestContext;
            }
            //throw new ApplicationException("Request context not set during request start.");
            return null;
        }

        public void SetRequestContext(RequestContext requestContext)
        {
            HttpContext.Current.Items["requestContext"] = requestContext;
        }
    }
}